const path = require('path')
const HTMLWebpackPlugin =require('html-webpack-plugin');
const {CleanWebpackPlugin} = require('clean-webpack-plugin')
module.exports ={
    entry:"./index.ts",
    output:{
        path:path.resolve(__dirname,'dist'),
        filename:"bundle.js",
        environment:{
            arrowFunction:false
        }
    },
    mode: 'development' ,
    module:{
        rules:[{
            test:/\.ts$/,
            use:[{
                loader:"babel-loader",
                options:{
                    preset:[
                        [
                            "@babel/preset-set",
                            {
                                targets:{
                                    "chrome":'88'
                                },
                                "corejs":'3',
                                "useBuiltIns":"usage"
                            }
                        ]
                    ]
                }
            },'ts-loader'],
            exclude:/node-modules/
        }]
    },
    //配置webpack插件
    plugins:[
        new HTMLWebpackPlugin({
            title:'App'
        }),
        new CleanWebpackPlugin(),
    ],
    resolve:{
        extensions:['.ts','.js']
    }
}